{% if en %}
    {% for config, val in {
    "API URL": ("frp_api_url", "Frp API to connect to"),
    "Http Domain Suffix": ("frp_http_domain_suffix", "Will be appended to the hash of a container"),
    "External Http Port": ("frp_http_port", "Keep in sync with frps:vhost_http_port"),
    "Direct IP Address":("frp_direct_ip_address","For direct redirect"),
    "Direct Minimum Port": ("frp_direct_port_minimum", "For direct redirect (pwn challenges)"),
    "Direct Maximum Port": ("frp_direct_port_maximum", "For direct redirect (pwn challenges)"),
}.items() %}
        {% set value = get_config('whale:' + val[0]) %}
        <div class="form-group">
            <label for="{{ val[0].replace('_', '-') }}">
                {{ config }}
                <small class="form-text text-muted">
                    {{ val[1] }}
                </small>
            </label>
            <input type="text" class="form-control" id="{{ val[0].replace('_', '-') }}" name="{{ 'whale:' + val[0] }}"
                   {% if
        value !=None %}value="{{ value }}" {% endif %}>
        </div>
    {% endfor %}
    {% set frpc_template = get_config("whale:frp_config_template") %}
    <div class="form-group">
        <label for="frp-config-template">
            Frpc config template
            <small class="form-text text-muted">
                Frp config template, only need common section!
            </small>
        </label>
        <textarea class="form-control input-filled-valid" id="frp-config-template" rows="7"
                  name="whale:frp_config_template">{{ frpc_template }}</textarea>
    </div>
    {% if frpc_template %}
        <div class="form-group">
            <label for="frps-config-template">
                Frps config template [generated]
                <small class="form-text text-muted">
                    This configuration is generated with your settings above.
                </small>
            </label>
            <textarea class="form-control input-filled-valid grey-text" id="frps-config-template" rows="6" disabled>
[common]
{% for i in frpc_template.split('\n') %}
{%- if 'token' in i -%}{{ i }}{%- endif -%}
{%- if 'server_port' in i -%}{{ i.replace('server_port', 'bind_port') }}{%- endif -%}
{% endfor %}
vhost_http_port = {{ get_config('whale:frp_http_port') }}
subdomain_host = {{ get_config('whale:frp_http_domain_suffix', '127.0.0.1.xip.io').lstrip('.') }}
            </textarea>
        </div>
    {% endif %}
{% else %}
    {% for config, val in {
    "API网址": ("frp_api_url", "Frp API 连接的地址"),
    "HTTP 域后缀": ("frp_http_domain_suffix", "将被附加到容器的哈希值中"),
    "HTTP端口": ("frp_http_port", "用于http重定向"),
    "直连IP地址":("frp_direct_ip_address","用于直连重定向"),
    "直连最小端口": ("frp_direct_port_minimum", "用于直连重定向"),
    "直连最大端口": ("frp_direct_port_maximum", "用于直连重定向"),
}.items() %}
        {% set value = get_config('whale:' + val[0]) %}
        <div class="form-group">
            <label for="{{ val[0].replace('_', '-') }}">
                {{ config }}
                <small class="form-text text-muted">
                    {{ val[1] }}
                </small>
            </label>
            <input type="text" class="form-control" id="{{ val[0].replace('_', '-') }}" name="{{ 'whale:' + val[0] }}"
                   {% if
        value !=None %}value="{{ value }}" {% endif %}>
        </div>
    {% endfor %}
    {% set frpc_template = get_config("whale:frp_config_template") %}
    <div class="form-group">
        <label for="frp-config-template">
            Frpc 配置模板
            <small class="form-text text-muted">
                Frp配置模板，只需要Common部分！
            </small>
        </label>
        <textarea class="form-control input-filled-valid" id="frp-config-template" rows="7"
                  name="whale:frp_config_template">{{ frpc_template }}</textarea>
    </div>
    {% if frpc_template %}
        <div class="form-group">
            <label for="frps-config-template">
                Frps 配置模板 [自动生成]
                <small class="form-text text-muted">
                    此配置是根据您的上述设置生成的。
                </small>
            </label>
            <textarea class="form-control input-filled-valid grey-text" id="frps-config-template" rows="6" disabled>
[common]
{% for i in frpc_template.split('\n') %}
{%- if 'token' in i -%}{{ i }}{%- endif -%}
{%- if 'server_port' in i -%}{{ i.replace('server_port', 'bind_port') }}{%- endif -%}
{% endfor %}
vhost_http_port = {{ get_config('whale:frp_http_port') }}
subdomain_host = {{ get_config('whale:frp_http_domain_suffix', '127.0.0.1.xip.io').lstrip('.') }}
            </textarea>
        </div>
    {% endif %}
{% endif %}
